package com.qianli.cashmama.trade.common.enums;

/**
 * Author: Karl
 * Date: 2020/11/6 5:39 下午
 */
public enum WithdrawProductMappingEnum {
    sdzzall_Mapping("sdzzall", "cashZoneAll", true, "39"),
    cashZoneAll_Mapping("cashZoneAll", "cashZoneAll", false, ""),
    loanZoneAll_Mapping("loanZoneAll", "loanZoneAll", false, ""),
    ;

    private String sourceProductCategory;
    private String targetProductCategory;
    private boolean isCopy;
    private String targetAppCode;

    WithdrawProductMappingEnum(String sourceProductCategory, String targetProductCategory, boolean isCopy, String targetAppCode) {
        this.sourceProductCategory = sourceProductCategory;
        this.targetProductCategory = targetProductCategory;
        this.isCopy = isCopy;
        this.targetAppCode = targetAppCode;
    }

    public WithdrawProductMappingEnum setTargetAppCode(String targetAppCode) {
        this.targetAppCode = targetAppCode;
        return this;
    }

    public String getSourceProductCategory() {
        return sourceProductCategory;
    }

    public WithdrawProductMappingEnum setSourceProductCategory(String sourceProductCategory) {
        this.sourceProductCategory = sourceProductCategory;
        return this;
    }

    public String getTargetProductCategory() {
        return targetProductCategory;
    }

    public WithdrawProductMappingEnum setTargetProductCategory(String targetProductCategory) {
        this.targetProductCategory = targetProductCategory;
        return this;
    }

    public boolean isCopy() {
        return isCopy;
    }

    public WithdrawProductMappingEnum setCopy(boolean copy) {
        isCopy = copy;
        return this;
    }

    public String getTargetAppCode() {
        return targetAppCode;
    }

    public static boolean containCategory(String productCategory) {
        for (WithdrawProductMappingEnum e : WithdrawProductMappingEnum.values()) {
            if (e.getSourceProductCategory().equals(productCategory)) {
                return true;
            }
        }
        return false;
    }

    public static WithdrawProductMappingEnum getEnum(String productCategory) {
        for (WithdrawProductMappingEnum e : WithdrawProductMappingEnum.values()) {
            if (e.getSourceProductCategory().equals(productCategory)) {
                return e;
            }
        }
        return null;
    }
}
